package com.joysuch.wwyt.api.mh.enums;


public enum MonitPointFieldDataType {

    LIST("List", "列表"), STRING("String", "字符"),DATE("Date", "日期"),
    JSON("Json", "Json对象"),UUID("UUID","UUID");

    private String code;
    private String name;

    private MonitPointFieldDataType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static MonitPointFieldDataType findByName(String name) {
        MonitPointFieldDataType[] values = MonitPointFieldDataType.values();
        for (MonitPointFieldDataType v : values) {
            if (v.getName().equals(name)) {
                return v;
            }
        }
        return null;
    }

    public static MonitPointFieldDataType findByCode(String code) {
        MonitPointFieldDataType[] values = MonitPointFieldDataType.values();
        for (MonitPointFieldDataType v : values) {
            if (v.getCode().equals(code)) {
                return v;
            }
        }
        return null;
    }

    public static String findNameByCode(String code) {
        MonitPointFieldDataType types = findByCode(code);
        return types == null ? null : types.name;
    }
}
